{% extends "base.html" %}

{% load comments %}
{% load i18n %}

{% block title %}| Blog - {{ entry.title|escape }}{% endblock %}

{% block body %}

<h1>{{ entry.title }}</h1>
    <div>
		<div style="margin-left:30px;background:#333; border-right:50px solid #151515;">
      {{ entry.body|safe}}
		</div>
    </div>

<div style="color:#999;"> Postado em <i>{{ entry.pub_date|date:"F j, Y" }}</div></i>

  {% get_comment_list for entry as comment_list %}
  {% if comment_list %}
  <div id="comments">
    <a name="comments"></a>
    <h3 class="comments_title">{% trans "Comentarios" %}</h3>
    {% for comment in comment_list %}
      {% if comment.is_public %}
      <div class="comment">
        <h5 class="name">
			 <img src="{{comment.user_url}}" width=30>
          <a href="/rank/{{ comment.user.username}}" title="{{comment.user_name}}"> {{ comment.user.username }}</a> disse ...
        </h5>
		<div style="margin-left:30px;background:#333; border-right:50px solid #151515;">
			<table style="table-layout: fixed;" width=720>
				<tr> <td width=720>
        		<pre style="white-space: pre-wrap;" >{{ comment.comment|safe }}</pre>
				</td><tr>
			</table>
		</div>
		<div style="margin-left:30px;background:#333; border-right:500px solid #151515;">
        <p class="date"><b>Postado em </b>{{ comment.submit_date|date:"P" }} {{ comment.submit_date|date:"F j, Y" }}</p>
		</div>
      </div>
      {% endif %}
    {% endfor %}
  </div>
  {% endif %}
	
<h2> Comente </h2>
  {% if entry.enable_comments %}
		{% if request.user.is_authenticated %}
{% get_comment_form for entry as form %}
    <form action="{% comment_form_target %}" method="POST">{% csrf_token %}
{{ form.comment }} 
{{ form.content_type }} 
{{ form.object_pk }} 
{{ form.timestamp }} 
{{ form.security_hash }} 

<input name="url"    id="id_url"    type="hidden" value="{{user.pic_url}}" />
<br/>
<input type="submit" value="Comente" id="id_submit" />
</form> 
		{% else %}
			Logue para comentar.
		{% endif %}
  {% else %}
    <div id="comment_form">
      <h3>{% trans "Comentarios fechados" %}.</h3>
      <p>{% trans "Este post nao aceita comentarios" %}.</p>
    </div>
  {% endif %}

{% endblock %}
